import {
	axios
} from './request.js';

// 广告轮播接口
export const bannerList = () => {
	return axios({
		url: '/prod-api/api/takeout/rotation/list'
	})

}

// 查询店家列表
export const sellerList = () => {
	return axios({
		url: '/prod-api/api/takeout/seller/list'
	})

}

// 获取店家详情
export const storeData = (id) => {
	return axios({
		url: `/prod-api/api/takeout/seller/${id}`
	})

}

// 查询店家评论列表
export const getComment = (sellerId) => {
	return axios({
		url: `/prod-api/api/takeout/comment/list?sellerId=${sellerId}`

	})
}

// 添加店家评论
export const addComment = ({
	header,
	data
}) => {
	return axios({
		url: `/prod-api/api/takeout/comment`,
		method: "post",
		header
	})
}

// 查询店家菜品类别
export const categoryList = (sellerId) => {
	return axios({
		url: `/prod-api/api/takeout/category/list?sellerId=${sellerId}`
	})
}

// 查询店家菜品类别
export const goodsDataList = (sellerId, categoryId) => {
	return axios({
		// url: `/prod-api/api/takeout/product/list?sellerId=2&categoryId=8`
		url: `/prod-api/api/takeout/product/list?sellerId=${sellerId}&categoryId=${categoryId}`
	})
}

// 菜品查询店家信息
export const searchGoods = (keyword) => {
	return axios({
		url: `/prod-api/api/takeout/search?keyword=${keyword}`
		// url: `/prod-api/api/takeout/search`
	})
}

// 创建订单
export const CreateOrder = ({
	header,
	data
}) => {
	return axios({
		url: `/prod-api/api/takeout/order/create`,
		method: "post",
		data,
		header: {
			"Authorization": uni.getStorageSync('token')
		}

	})
}

// 支付订单
export const payment = ({
	header,
	data
}) => {
	return axios({
		url: `/prod-api/api/takeout/pay`,
		method: "post",
		data,
		header: {
			"Authorization": uni.getStorageSync('token')
		}

	})
}

// 获取当前用户收货地址列表
export const getAddressList = (header) => {
	return axios({
		url: `/prod-api/api/takeout/address/list`,
		header: {
			"Authorization": uni.getStorageSync('token')
		}

	})
}

// 获取收货地址详细信息
export const getAddress = (header) => {
	return axios({
		url: `/prod-api/api/takeout/address/8`,
		header: {
			"Authorization": uni.getStorageSync('token')
		}
	})
}